package atguigu.dao.impl;

import atguigu.dao.AccountDao;
import atguigu.pojo.Account;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.List;

@Repository
public class AccountDaoImpl implements AccountDao {
    /**
     *  依赖QueryRunner对象，注入
     */
    @Autowired
    private QueryRunner qr;

    @Override
    public List<Account> queryAccount() throws SQLException {
        return qr.query("select * from account",new BeanListHandler<Account>(Account.class));
    }
}
